package com.huodongjia.controller;

import com.huodongjia.pojo.User;
import com.huodongjia.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    UserService userService;
    @RequestMapping("/login")
    public int login(String username,String password){
        return userService.login(username,password);
    }
    @RequestMapping("/findById")
    public User findById(int id){
        return userService.findById(id);
    }
    @RequestMapping("/register")
    public int register(String username, String password, MultipartFile image) throws IOException {
        return userService.register(username,password,image);
    }
    @RequestMapping("/bevip")
    public void bevip(int userId,String organization){
        userService.bevip(userId,organization);
    }
}
